#include "ip.h"
#include "usart1.h"
#include "string.h"

#ifndef NULL
#define NULL			((void *)0)
#endif

static IP_INTERFACE_T _obj_ip = {
	.data = NULL,
	.data_size = 0x0,
	.version = 0x0,
	.head_size = 0x14,
	.size = 0x0,
	.identification = 0x46,
	.flag = 0x0,
	.offset = 0x0,
	.time_live = 0x80,
	.protocol = 0x0,
	.checksum = 0x0,
	.src_ip = 0x0,
	.dest_ip = 0x0,
	.alloc = NULL,
	.tobuf = NULL,
	.free = NULL
};

void ip_init(unsigned char *src_ip)
{
	_obj_ip.src_ip = str_to_ip(src_ip);
}

void ip_get_interface(IP_INTERFACE_P *obj)
{
	*obj = &_obj_ip;
}